﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class UserControls_ctlComboBox : System.Web.UI.UserControl
{

    public bool Enabled
    {
        get
        {
            return DropDownList1.Enabled;
        }
        set
        {
            DropDownList1.Enabled = value;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    public void setDataSource(DataSet dataSet, string text, string value)
    {
        DropDownList1.DataSource = dataSet;
        DropDownList1.DataTextField = text;
        DropDownList1.DataValueField = value;
        DropDownList1.DataBind();
    }

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        
    }

    public void setSelectedId(string id){
        DropDownList1.Items.FindByValue(getSelectedId()).Selected = false;
        DropDownList1.Items.FindByValue(id).Selected = true;
    }

    public string getSelectedId()
    {
        string result = DropDownList1.SelectedItem.Value;
        return result;
    }

    public string getSelectedName()
    {
        string result = DropDownList1.SelectedItem.Text;
        return result;
    }
}
